<!DOCTYPE HTML>
<html>
<head>
<include file="Include:meta" />
<title>运营周报管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">运营管理 > 运营周报管理</div>
		<div class="right">
			<div class="input-group left w250">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按项目编号/名称搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
		</div>
	</div>
	<div id="content">
		<div class="table-scrollx">
			<table class="table table-bordered table-hover">
				<tr class="table-header fixed-table-header">
					<td width="500">
						周期
						<if condition="($action3 eq NULL) or ($action3 eq -1)">
							<a href="__APP__/Project/project_operate_reply/keyword/{$keyword}/action3/down/week/{$week}/year/{$year}"><i class="glyphicon glyphicon-sort"></i></a>
						<elseif condition="$action3 eq 'up'"/>
							<a href="__APP__/Project/project_operate_reply/keyword/{$keyword}/action3/down/week/{$week}/year/{$year}"><i class="glyphicon glyphicon-sort-by-attributes"></i></a>
						<elseif condition="$action3 eq 'down'"/>
							<a href="__APP__/Project/project_operate_reply/keyword/{$keyword}/action3/up/week/{$week}/year/{$year}"><i class="glyphicon glyphicon-sort-by-attributes-alt"></i></a>
						</if>
						<select name="year" class="form-control w100">
							<option value="-10"<if condition="$year eq -10"> selected</if>>年下拉 </option>
							<foreach name="year_list" item="vo">
							<option value="{$vo}"<if condition="$year eq $vo"> selected</if>>{$vo}</option>
							</foreach>
						</select>
						<select name="week" class="form-control w100">
							<option value="-10"<if condition="$week eq -10"> selected</if>>周期下拉 </option>
							<foreach name="week_list" item="vo">
							<option value="{$vo['num']}"<if condition="$week eq $vo['num']"> selected</if>>{$vo['detail']}</option>
							</foreach>
						</select>
					</td>
					<td width="150">项目编号</td>
					<td>项目名称</td>
					<td>附件</td>
					<td width="140">负责人(日期)</td>
					<if condition="is_permission('ZB',NULL,1)">
					<td width="80">管理</td>
					</if>
				</tr>
				<if condition="$result eq NULL">
				<tr><td class='text-center' <if condition="is_permission('ZB',NULL,1)">colspan="6"<else />colspan="5"</if>>暂无相关内容</td></tr>
				</if>
				<foreach name="result" item="vo">
					<tr>
						<td><a href="__APP__/Project/project_operate_detail/id/{$vo['id']}/pid/{$vo['pid']}/audit/1/keyword/{$keyword}" target="_blank">{$vo['year']}年&nbsp;{$vo['week_detail']}</a></td>
						<td>{$vo['project_num']}</td>
						<td>{$vo['project_name']}</td>
						<td><if condition="$vo['file_url'] neq NULL">{$vo['file_name']}<a href="{$vo['file_url']}" class="ml5" data-toggle="tooltip" data-placement="right" title="下载"><i class="glyphicon glyphicon-download-alt"></i></a></if></td>
						<td>{$vo['add_user']}({$vo['add_date']|substr=0,10})</td>
						<if condition="is_permission('ZB',NULL,1)">
						<td>
							<if condition="$vo['message'] eq NULL">
								<a href="javascript:;" mid="{$vo['id']}" class="audit">批复</a>
							</if>
						</td>
						</if>
					</tr>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--批复弹框-->
<div class="modal fade" id="edit-modal">
	<div class="modal-dialog w600">
		<div class="modal-content">
			<div class="modal-header">
				<h4></h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body" style="line-height:30px;">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="74"><strong><span class="asterisk">*</span>批复意见</strong></td>
						<td>
							<textarea name="audit_message" class="form-control required-text" style="width:100%; height:150px" autocomplete="off">{$operate['audit_message']}</textarea>
							<span class="error-item">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm">确认</button><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//搜索
	$(".found_btn").keywordSearch("__APP__/Project/project_operate_reply/keyword/$keyword/action3/{$action3}/week/{$week}/year/{$year}");
	
	$(document).on("change","[name='week']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_operate_reply/keyword/{$keyword}/action3/{$action3}/week/"+val+"/year/{$year}";
	});
	$(document).on("change","[name='year']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_operate_reply/keyword/{$keyword}/action3/{$action3}/week/{$week}/year/"+val;
	});
	//添加
	$(".audit").on("click",function(){
		var modal = $("#edit-modal"),
			mid = $(this).attr("mid");
		modal.find(".modal-header h4").text("批复");
		modal.find(".file-name").prop("readonly",true);
		modal.find(".file-delete").hide();
		modal.find(".btn-affirm").attr({"mid":mid});
		modal.modal();
		modal.find("textarea").val('');
	});
	$(".audit2").on("click",function(){
		var modal = $("#edit-modal"),
			mid = $(this).attr("mid"),
			con = $(this).attr('con');
		modal.find(".modal-header h4").text("批复");
		modal.find(".file-name").prop("readonly",true);
		modal.find(".file-delete").hide();
		modal.modal();
		modal.find(".btn-affirm").attr({"mid":mid});
		modal.find("textarea").val(con);
	});
	
	//取消
	$("#edit-modal").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
	});
	//审核&弃审
	$("#edit-modal").find(".btn-affirm").on("click",function(){
		var tag = false;
		$(".required-text").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).next(".error-item").show();
				tag = true;
			}
		});
		
		if(tag){
			return false;
		}else{
			var mid = $(this).attr("mid"),
				audit_message = $("[name='audit_message']").val(),
				modal = $("#edit-modal");
			modal.hide();
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"id":mid,"answer_content":audit_message,"action":"answer"},
				url:"__APP__/Project/project_operate_ajax",
				success:function(data){
					success_pop(data.status);
				}
			});
		}
	});
	$(document).on("focus",".required-text",function(){
		$(this).nextAll(".error-item").hide();
	});
});
</script>
</body>
</html>